#include<iostream>
#include<cstdio>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<string.h>
const std::string myenv = "HELLO=66666666";

int main()
{
    putenv((char*)myenv.c_str());
    pid_t id = fork();
    if(id == 0)
    {
        char* const argv[]={
            (char*)"kk",
          //(char*)"ls",
            //(char*)"-a",
            //(char*)"-l",
            nullptr
        };
       //execvp()
        //execv("/bin/ls",argv);
        char* const env[]={
            (char*)"HELLO=bite",
            (char*)"HELLO1=bite1",
            (char*)"HELLO2=bite2",
            (char*)"HELLO3=bite3"
        };
       // execvpe("./kk" , argv , env);
       
       execl("./kk","kk",nullptr);
        exit(1);
    }
    pid_t rid = waitpid(id,nullptr,0);
    if(rid > 0)
    {
        printf("等待子进程成功\n");
    }

   // execl("/bin/ls","ls","-l","-a",nullptr);
  // execl("/usr/bin/top","top",nullptr);
    return 0;
}
